package com.ato.mybatis.service.impl;

import com.ato.mybatis.dao.UserDao;
import com.ato.mybatis.pojo.UserPojo;
import com.ato.mybatis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author wangjing
 * @create 2021--09--23--下午 5:21
 */
@Service

public class ImplUserService implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<UserPojo> findAll() {
        List<UserPojo> users = userDao.findAll();
        return users;
    }

    @Override
    public UserPojo findUserByID(long id) {
        UserPojo user = userDao.findUserByID(id);
        return user;
    }

    @Transactional
    @Override
    public int insertUser(UserPojo user) {

        return userDao.insertUser(user);
    }
}
